/* 
 * File:   systask.h
 * Author: apleilx
 */

#ifndef LICENSE__H_
#define LICENSE__H_

#ifdef _LICENSE_MODULE_
#define ___EXT___
#else
#define ___EXT___ extern
#endif

#include "stdint.h"

#ifdef __cplusplus
extern "C"
{
#endif

#define LIC_EN_FLAG 0x55AA

#define LIC_DEC_MODE_CRC	0x11
#define LIC_DEC_MODE_SWAP	0x22
#define LIC_DEC_MODE_DES	0x44

#define LIC_PER_SET_NUM 120

	typedef struct
	{
		int32_t val;
		uint16_t en;
		uint16_t crc;
	} lic_str_type;

	typedef struct
	{
		uint8_t b_ok;		  // 指示系统是否可运行
		uint8_t b_decode_req; // 解码请求

		lic_str_type info;

	} lic_man_type;

	___EXT___ lic_man_type lic_man;

	void license_check(void);
	void license_init(void);
	void license_use_once(void);
	void license_dec_req(uint8_t mode);

#ifdef __cplusplus
}
#endif

#undef ___EXT___

#endif /* LICENSE__H_ */
